package com.lhy.common.vo;

import lombok.Data;

@Data
public class Result<T>{
    private Result(){}

    private Result(Integer code, Integer danger,String message, Object data, Long count) {
        this.code = code;
        this.danger=danger;
        this.message = message;
        this.data = data;
        this.count = count;
    }

    private Integer code; //0成功
    private Integer danger; //危险值 1：有危险  0：没危险
    private String message;  //返回描述
    private Object data;   //返回数据
    private Long count;  //分页查询的总记录数

    //主任工程师（权限管理）
    public static Result<Object> managerSuccess(){
        return new Result(0,0,"managerSuccess",null,null);
    }

    //负责人登陆成功
    //监测实时数据、管理监察员
    public static Result<Object> inspectorSuccess(){
        return new Result(1,0,"inspectorSuccess",null,null);
    }

    //普通员工登陆成功
    public static Result<Object> userSuccess(){
        return new Result(2,0,"userSuccess",null,null);
    }

    //登陆失败
    public static Result<Object> fail(){
        return new Result(-1,0,"fail",null,null);
    }
    public static Result<Object> fail(String message){
        return new Result(-1,0,message,null,null);
    }

    public static Result success() {
        Result result = new Result<>();
        result.setCode(0);
        result.setMessage("成功");
        return result;
    }

}
